﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.LichLamViecModel.LichLamViecForm>" %>

<%@ Import Namespace="QLPKWeb.Models.LinQ.LichLamViec" %>
<%@ Import Namespace="QLPKWeb.Models.LinQ.Common" %>
<%@ Import Namespace="QLPKWeb.Models.FormBean.LichLamViecModel" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/LichLamViec/ViewLich.js") %>"></script>
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/KiemTra.js") %>"></script>
    <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                selectMenu("LichLamViec-DangKyLich");
                $("#LichLamViec-DangKyLich").parent().attr("class", "opened");
            });
            $(document).ready(function () {
                $("#ToDate").datepicker({ dateFormat: 'dd/mm/yy' });
                $("#FromDate").datepicker({ dateFormat: 'dd/mm/yy' });
            });

            $(function () {
                $("#tabs").tabs();
            });
    </script>
    <form id="form" method="post" action="#">
        <input type="hidden" id="IdDepartment" name="IdDepartment" value="0"/>
        <input type="hidden" id="Type" name="Type" value="-2"/>
        <input type="hidden" id="ID" name="ID" value="<%=Model.ID %>"/>
        <div class="box">
            <table class="table_outsite">
                <tr>
                    <td colspan="4">
                        <span style="display:inline;">Chọn ngày</span>
                        <input name="FromDate" id="FromDate" 
                            value="<%= Model.FromDate %>" 
                            style="display: inline;" />
                        <%--<span style="display:inline; margin-left: 40px;">Đến ngày</span>
                        <input name="ToDate" id="ToDate" 
                            value="<%= Model.ToDate != null ? Model.ToDate.Value.ToString("dd/MM/yyyy") : DateTime.Now.AddDays(3).ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />--%>
                        <input type="button" value="Xem" onclick="javascript:DoView()" style="display: inline;" />
                        <%--<input type="button" value="In lịch" onclick="javascript:DoIn()" style="display: inline;" />  --%>                      
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                    </td>
                    <%--<td><a onclick="javascript:DoViewTruongPhong(-2);">Lịch làm việc của Lãnh đạo sở</a></td>
                    <td><a onclick="javascript:DoViewTruongPhong(0);">Lịch làm việc của Trưởng phòng</a></td>
                    <td><a onclick="javascript:DoViewChuenVien();">Lịch làm việc của chuyên viên</a></td>--%>
                </tr>
                <tr>
                    <td colspan="4">
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                    </td>
                </tr>
            </table>
            
                <div id="tabs">
                    <ul>
                        <li>
                            <a href="#ViewLich" onclick="javascript:DoViewLichSo();">Lịch sở</a>
                        </li>
                        <li>
                            <a href="#ViewLich" onclick="javascript:DoViewTruongPhong(-2);">Lịch làm việc của Lãnh đạo sở</a>
                        </li>
                        <li>
                            <a href="#ViewLich" onclick="javascript:DoViewTruongPhong(0);">Lịch làm việc của Trưởng phòng</a>
                        </li>
                        <li>
                            <a href="#ViewLich" onclick="javascript:DoViewChuenVien();">Lịch làm việc của chuyên viên</a>
                        </li>
                    </ul>	                        
                    <div id="LichChuyenVien">
                    </div>		
                            
                <div id="ViewLich">
                    <table width="100%" cellpadding="0" cellspacing="0" border="1px solid #e6e5df" style="font-family:Times New Roman; line-height:22px;" >
                        <tr>
                            <td nowrap="nowrap" align="center">
                                <strong>
                                    Ngày
                                </strong>
                            </td>
                            <td nowrap="nowrap" align="center">
                                <strong>
                                    T/G
                                </strong>
                            </td>
                            <td nowrap="nowrap" align="center">
                                <strong>
                                    Nội dung
                                </strong>
                            </td>
                            <td nowrap="nowrap" align="center">
                                <strong>
                                    Phân công
                                </strong>
                            </td>
                        </tr>
                        <% for (int i = 1; i < 7; i++)
                           {
                               //List<LichLamViec> listLich = Model.ListLichDaDuyet
                               //    .Where(p => (int)p.EventDate.Value.DayOfWeek == i).ToList();
                               List<LichLamViec> listLich = Model.ListLichDaDuyet
                                   .Where(p => (int)p.StartTime.Value.DayOfWeek == i).ToList();
                                %>
                        <tr>
                            <td style='padding-left:3px;' align='center'>
                                <%= "Thứ " + (i + 1).ToString() %>
                            </td>
                            <td style='padding-left:3px;' align='center'>
                                <%
                               foreach (LichLamViec item in listLich)
                               {
                                   %>
                                <%--   <%= item.StartTime != null ? item.StartTime.Value.ToString("HH:mm") : "" %>
                                   <span> - </span>
                                   <%= item.EndTime != null ? item.EndTime.Value.ToString("HH:mm") : ""%>
                                   <br />--%>
                                   <span> Ngày </span>
                                   <%= item.StartTime != null ? "<b>" + item.StartTime.Value.ToString("dd/MM/yyyy") + "</b>" + " Lúc " + item.StartTime.Value.ToString("HH:mm") : "" %>
                                   <span> - </span>
                                   <span> Ngày </span>
                                   <%= item.EndTime != null ? "<b>" + item.EndTime.Value.ToString("dd/MM/yyyy") + "</b>" + " Lúc " + item.EndTime.Value.ToString("HH:mm") : ""%>
                                   <br />
                                   <%
                               }
                                %>
                            </td>
                            <td style='padding-left:3px;' align="left">
                                <%
                               foreach (LichLamViec item in listLich)
                               {
                                   %>
                                   <span> - </span>
                                   <a onclick="javascript:window.location.href = basePath + 'LichLamViec/XemLichLamViec/<%= item.ID %>'">
                                       <%= item.NoiDung %>
                                   </a>
                                   <br />
                                   <%
                               }
                                %>
                            </td>
                            <td style='padding-left:3px;' align="left">
                                <%
                               foreach (LichLamViec item in listLich)
                               {
                                   %>
                                   <span> - </span>
                                   <%= Model.GetDisplayNameOfThanhPhan(item.LichLamViecShareds.ToList(),2) %>
                                   <br />
                                   <%
                               }
                                %>
                            </td>
                        </tr>
                        <%
                           } %>
                    </table>
                <%--<table width="100%" cellpadding="0" cellspacing="0" border="1px solid #e6e5df" style="font-family:Times New Roman; font-size:15px; line-height:22px;">
                    <tr>
                        <td nowrap="nowrap" align="center">
                            <strong>STT</strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Họ và tên
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Chức vụ
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ hai
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ ba
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ tư
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ năm
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ sáu
                            </strong>
                        </td>
                        <td nowrap="nowrap" align="center">
                            <strong>
                                Thứ bảy
                            </strong>
                        </td>
                    </tr>
                    <% 
                        int i = 1;
                        foreach (TB_User item in Model.ListDisplayUser)
                        {
                    %>
                    <tr>
                        <td align="center">
                            <%= i %>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= ((string.IsNullOrEmpty(item.LastName) || string.IsNullOrEmpty(item.FirstName))
                                ? item.UserName
                                : item.LastName + " " + item.FirstName) %>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= item.TB_JobTitle.JobTitle %>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(1, item.ID) %>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(2, item.ID)%>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(3, item.ID)%>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(4, item.ID)%>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(5, item.ID)%>
                        </td>
                        <td nowrap="nowrap" style='padding-left:3px;'>
                            <%= Model.CheckDayIsInListLichLamViec(6, item.ID)%>
                        </td>
                    </tr>
                    <%} %>
                </table>--%>
                </div>
                </div>
        </div>
    </form>

    <div style='width:250px; height:180px;display:none; z-index:100000;  position:absolute; border:5px solid #ddd; background:#fff; padding:4px' id="ViewThanhPhan">
        <div style='width:100%; height:10px;'>
        <img src="<%=ResolveUrl("~/Content/ImagesAdmin/publish_x.png")%>" style='float:right; margin:3px; cursor:pointer;' title='close' 
            onclick='$("#ViewThanhPhan").css("display", "none")'>
        </div>
        <div style='width:100%; height:90px; overflow:auto'>
            <div id="tbl_DanhSachThanhPhan">
                <table>
                    <tbody>
                               
                    </tbody>
                </table>
            </div>
        </div>
        <div class="pagebreak"> &nbsp;</div>
        <div style="text-align:center"><input type="button" id="Button1" name="OK" value="OK" class="button1" onclick='$("#ViewThanhPhan").css("display", "none")'/></div>
    </div>
</asp:Content>
